#include using namespace std; void main() { //valid variable names //must start with a letter or _ //cannot have special characters //cannot have any white space //may contain a number //variable names (Steil's rules) //camel case averageDailyBalance //descriptive int hour, minute; bool useMilitaryTime = false; char c; cout << "(M)ilitary or (S)tandard time? "; cin >> c; if(c == 'M' || c == 'm') { useMilitaryTime = true; } // \n escape sequence for carriage return cout << "Enter a time below:\n"; cout << "hours? "; cin >> hour; cout << "minutes? "; cin >> minute; //if((useMilitaryTime && hour >= 0 && hour <= 23) || // (!useMilitaryTime && hour >=1 && hour <= 12)) //{ // if(minute >=0 && minute <= 59) // { // cout << "The time is valid " << endl; // } // else // { // cout << "The time is NOT valid " << endl; // } //} //else //{ // cout << "The time is NOT valid " << endl; //} if(((useMilitaryTime && hour >= 0 && hour <= 23) || (!useMilitaryTime && hour >=1 && hour <= 12)) && (minute >=0 && minute <= 59)) { cout << "The time is valid " << endl; } else { cout << "The time is NOT valid " << endl; } }